package edu.washington.cs.workflow.util;

public class SimpleClock {

	static long startTime = -1l;
	
	public static void reset() {
		startTime = -1l;
	}
	
	public static void start() {
		Utils.checkTrue(startTime == -1l);
		startTime = System.currentTimeMillis();
	}
	
	public static void stopAndPrint() {
		Utils.checkTrue(startTime != -1l);
		long now = System.currentTimeMillis();
		long elapsed = now - startTime;
		System.out.println("Time cost: " + ((elapsed)/1000) + " seconds");
		startTime = -1l;
	}
	
}